package org.bozo.im.service.protocols.xmpp;

import java.util.Hashtable;

import org.bozo.im.service.IMSessionConfiguration;
import org.bozo.im.service.protocols.xmpp.stanza.generator.StanzaGenerator;
import org.bozo.im.service.protocols.xmpp.util.jid.JID;

public class XMPPSessionConfiguration extends IMSessionConfiguration {
	
	// ---------------------------------------------------------------------------------------
	// Variables
	// ---------------------------------------------------------------------------------------
	
	private JID lJid;
	private String mLang = null;
	private String mTo = null;
	
	private StanzaGenerator mInitialStream;
	private StanzaGenerator mResponseStream;
	
	private Hashtable<String, Object> mProperties;

	// ---------------------------------------------------------------------------------------
	// Constructor
	// ---------------------------------------------------------------------------------------
	
	public XMPPSessionConfiguration() {
		super();
		mProperties = new Hashtable<String, Object>();
	}
	
	// ---------------------------------------------------------------------------------------
	// Properties related methods
	// ---------------------------------------------------------------------------------------
	
	public void putProperty(String pName, Object pObj) {
		mProperties.put(pName, pObj);
	}
	public Object getProperty(String pName) {
		return mProperties.get(pName);
	}
	
	@Override
	public void setLogin(String pLogin) {
		super.setLogin(pLogin);
		lJid = new JID(getLogin());
		mTo = lJid.getDomain();
	}
	
	// ---------------------------------------------------------------------------------------
	// Getters
	// ---------------------------------------------------------------------------------------
	
	public JID getLoginJID() {
		return lJid;
	}
	public StanzaGenerator getInitialStream() {
		return mInitialStream;
	}
	public StanzaGenerator getResponseStream() {
		return mResponseStream;
	}
	public String getLang() {
		return mLang;
	}
	public String getTo() {
		return mTo;
	}
	
	// ---------------------------------------------------------------------------------------
	// Setters
	// ---------------------------------------------------------------------------------------
	
	public void setInitialStream(StanzaGenerator pInitialStream) {
		mInitialStream = pInitialStream;
	}
	public void setResponseStream(StanzaGenerator pResponseStream) {
		mResponseStream = pResponseStream;
	}
}
